/*
 * @Author: chendeji
 * @Date: 2021-11-15 10:27:09
 * @LastEditTime: 2021-11-18 13:48:03
 * @Description: 
 * @FilePath: \copy_gsy_github_app_flutter\lib\main.dart
 * 联系方式：
 * wx: melody_2009
 * qq: 7815171323 
 */
import 'dart:async';

import 'package:copy_gsy_github_app_flutter/app.dart';
import 'package:copy_gsy_github_app_flutter/common/env/config_wrapper.dart';
import 'package:copy_gsy_github_app_flutter/common/env/env_config.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/physics.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

import 'common/env/dev.dart';

void main() {
  GestureBinding.instance?.resamplingEnabled = true;
  runZonedGuarded(() {
    ErrorWidget.builder = (details) {
      Zone.current.handleUncaughtError(details.exception, details.stack!);
      return ErrorWidget.withDetails(
          message: '出错啦！！',
          error: details.exception is FlutterError
              ? details.exception as FlutterError
              : null);
    };

    runApp(ConfigWrapper(
      child: ScreenUtilInit(
        designSize: Size(360, 690),
        builder: () => RefreshConfiguration(
            headerBuilder: () => WaterDropHeader(),
            footerBuilder: () => ClassicFooter(),
            headerTriggerDistance: 80.h,
            springDescription: SpringDescription(
                stiffness: 170,
                damping: 16,
                mass:
                    1.9), // custom spring back animate,the props meaning see the flutter api
            maxOverScrollExtent:
                100, //The maximum dragging range of the head. Set this property if a rush out of the view area occurs
            maxUnderScrollExtent: 0, // Maximum dragging range at the bottom
            enableScrollWhenRefreshCompleted:
                true, //This property is incompatible with PageView and TabBarView. If you need TabBarView to slide left and right, you need to set it to true.
            enableLoadingWhenFailed:
                true, //In the case of load failure, users can still trigger more loads by gesture pull-up.
            hideFooterWhenNotFull:
                false, // Disable pull-up to load more functionality when Viewport is less than one screen
            enableBallisticLoad:
                true, // trigger load more by BallisticScrollActivity
            child: FlutterGetApp()),
      ),
      config: EnvConfig.fromJson(config),
    ));
  }, (obj, stack) {
    print(obj);
    print(stack);
  });
  // runApp(MyApp());
}
